#ifndef WIDGET_H
#define WIDGET_H

#include <QApplication>
#include <QWidget>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QFrame>
#include <QSplitter>
#include <QLabel>
#include <QUrl>
#include <QPixmap>
#include <QLineEdit>
#include <QPushButton>
#include <QTextEdit>
#include <QTableWidget>
#include <QHeaderView>
#include <QTcpSocket>
#include <QWidget>
#include <QPainter>
#include <QScreen>
#include <QFileDialog>
#include <QByteArray>
#include <QMessageBox>
#include "face.h"
#include "sql.h"

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget();
    ~Widget();

private:
    QWidget* createLoginTable();
    QWidget* createCheckInTable();
    QWidget* createRecordTable();
    void setContent();

private slots:
    void onLoginButtonClicked();
    void onFaceIdentifyButtonClicked();
    void onFaceRegisterButtonClicked();
    void getScreenshot();

    void recvVideo();

    void checkSuccess(QString student_id, double similarity);
    void checkFailed();
    void checkError(QString error);

    void onConnected();

    void updateTableWidget();

private:
    QTcpSocket* tcpClient;
    QByteArray* byteArray;
    FaceIdentify* faceIdentify;

    QTextEdit* infoTextEdit;
    QLabel *imageLabel;
    QLabel *videoLabel;
    QLineEdit *ipLineEdit;
    QLineEdit *portLineEdit;
    QPushButton *loginButton;
    QLineEdit *departmentLineEdit;
    QLineEdit *nameLineEdit;
    QPushButton *registerButton;
    QPushButton *recognizeButton;
    QTableWidget *tableWidget;
    QPushButton *showButton;
};

#endif // WIDGET_H
